

project, uses(../data_output/termlimited.dta)

	
	use ../data_output/termlimited.dta, clear

	areg first_log_sponsored max_terms_in_office  , a(chamber_term) r
	local r1 = _b[max_terms_in_office]
	local se1 = _se[max_terms_in_office]
	local n1 = e(N)
	local l1 = e(N)
	qui sum first_log_sponsored if e(sample)
	local m1 =  r(mean)
	local sd1 = r(sd)	
	
	areg first_cmt_index max_terms_in_office , a(chamber_term) r
	local r2 = _b[max_terms_in_office]
	local se2 = _se[max_terms_in_office]
	local n2 = e(N)
	local l2 = e(N)
	qui sum first_cmt_index if e(sample)
	local m2 =  r(mean)
	local sd2 = r(sd)
	
	areg first_pct_floor max_terms_in_office  , a(chamber_term) r
	local r3 = _b[max_terms_in_office]
	local se3 = _se[max_terms_in_office]
	local n3 = e(N)
	local l3 = e(N)
	qui sum first_pct_floor if e(sample)
	local m3 =  r(mean)
	local sd3 = r(sd)		
		
	areg first_pc1 max_terms_in_office , a(chamber_term) r
	local r4 = _b[max_terms_in_office]
	local se4 = _se[max_terms_in_office]	
	local n4 = e(N)
	local l4 = e(N)	
	qui sum first_pc1 if e(sample)
	local m4 =  r(mean)
	local sd4 = r(sd)	
	
	cap log close
	quietly {
	
		set linesize 255
		log using "../tables_figures/selection.tex", text replace
		
		noisily dis "\begin{table}[t]"
		noisily dis "\centering"
		noisily dis "\caption{\textbf{Electoral Selection for Productivity.}"
		noisily dis " On average, incumbents who survive more rounds of electoral selection "
		noisily dis "are more productive than those who survive fewer rounds. \label{tab:selection}} "
		noisily dis "\begin{tabular}{l cccc}"
		noisily dis "\toprule\toprule"
		noisily dis "& Log of Bills  & Committee  & Pct Floor & Productivity  \\"
		noisily dis "& Sponsored, & Activity, & Votes, & Index, \\"
		noisily dis "& $1^{st}$ Term  & $1^{st}$ Term  & $1^{st}$ Term & $1^{st}$ Term  \\[2mm]"

		noisily dis "& (1) & (2) & (3) & (4)  \\[1mm]"
		noisily dis "\midrule"
		noisily dis " Elections Won  & " %4.2f `r1' " & " %4.2f `r2' " & " %4.2f `r3' " & " %4.2f `r4'    "\\"
		noisily dis "  & (" %4.2f `se1' ") & (" %4.2f `se2' ") & (" %4.2f `se3' ") & (" %4.2f `se4' ")   \\[1mm]"
		noisily dis "\midrule "
		noisily dis " N & " %8.0fc `n1' " & " %8.0fc `n2' " & " %8.0fc `n3' " & " %8.0fc `n4'    "\\"
		noisily dis " Legislators & " %8.0fc `l1' " & " %8.0fc `l2' " & " %8.0fc `l3' " & " %8.0fc `l4'    "\\"
		noisily dis " Mean  & " %4.2f `m1' " & " %4.2f `m2' " & " %4.2f `m3' " & " %4.2f `m4'   "\\"
		noisily dis " Standard Dev.  & " %4.2f `sd1' " & " %4.2f `sd2' " & " %4.2f `sd3' " & " %4.2f `sd4'    "\\"

		noisily dis "Chamber-Year FE & Yes & Yes & Yes & Yes  \\ \midrule "

		noisily dis "\bottomrule \bottomrule\\[-4mm]"
		noisily dis "\multicolumn{5}{p{.8\textwidth}}{\small "
		noisily dis " Outcome variables are all measured using only the incumbent's first term in office, to measure type rather than learning."
		noisily dis " In columns 1 the outcome variable is the log of the number of sponsored bills, plus one."
		noisily dis " In columns 2 the outcome variable is an index of committee activity."
		noisily dis " In columns 3 the outcome is the percentage of roll-call votes the legislator is present for and votes on."
		noisily dis " In columns 4 the outcome variable is the first principal component from a PCA of the three measures of effort."
		noisily dis " The variable Elections Won is a simple count of the total number of elections a legislator has won over her entire career."
		noisily dis "The unit of observation is a legislator.  Dataset covers the 14 state legislative chambers with term limits"
		noisily dis " of three terms are longer, and covers legislative terms following elections from 1984-2014. "
		noisily dis "Robust standard clustered by legislator in parentheses.}"
		noisily dis "\end{tabular}"
		noisily dis "\end{table}"
	
		
		log off
	
	}
	
	
